package com.atguigu.msm.config;

import com.aliyuncs.CommonRequest;
import com.aliyuncs.DefaultAcsClient;
import com.aliyuncs.IAcsClient;
import com.aliyuncs.profile.DefaultProfile;
import org.mybatis.spring.annotation.MapperScan;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * 短信服务配置类
 * @author Summerday
 */

@Configuration
//@MapperScan(basePackages = {"com.atguigu.msm.mapper"})
public class MsmConfig {

    @Value("${aliyun.msm.file.accessKeyId}")
    private String accessKeyId;
    @Value("${aliyun.msm.file.accessKeySecret}")
    private String accessKeySecret;
    @Value("${aliyun.msm.file.regionId}")
    private String regionId;

    @Bean
    public DefaultProfile defaultProfile(){
        return DefaultProfile.getProfile(regionId,accessKeyId,accessKeySecret);
    }
    @Bean
    public IAcsClient iAcsClient(){
        return new DefaultAcsClient(defaultProfile());
    }

    @Bean
    public CommonRequest commonRequest(){
        return new CommonRequest();
    }

}
